<script>
	import { GetConfig, GetEnum, coinlist } from '@/api/Ctrls.js'
	import { GetGoodsTypePage1 } from '@/api/Goods.js'
	import permission from './utils/permission.js'
	import { onNetwork } from './utils/tools.js'
	import Updater from '@/utils/upgrade.js'
	export default {
		onLaunch(e) {
			this.runOnce(e);
		},
		onShow() {
			this.init();
		},
		methods: {
			async runOnce(e) {
				this.getLocation(); //设置定位
				GetGoodsTypePage1();
				this.$nextTick(() => {
					this.$store.dispatch('temporary/fetchFiles')
				})
				this.getSystemInfo();
				if (!e?.query) return
				const { invcode, token, type } = e.query
				if (invcode) {
					this.Cookie.set('Invcode', invcode)
				}
				if (token) {
					this.Cookie.set('token', token)
				}
			},
			async init() {

				coinlist();
				// permission();
				GetConfig();
				GetEnum();
				this.getSystemInfo();
			},
			// 获取系统信息
			async getSystemInfo() {
				let that = this;
				const res = await uni.getSystemInfoSync();
				const { language, uniPlatform, statusBarHeight } = res;
				let statusBar = statusBarHeight
				this.$store.commit('setting/SET_SYSINFO', res)
				this.Cookie.set('PlatForm', uniPlatform);
				// #ifdef MP-WEIXIN
				const { top, height,right,width }  = wx.getMenuButtonBoundingClientRect();
				statusBar = top - 6
				this.$store.commit('general/WX_MENUBUTTON', width*2 + 10) //导航栏高度
				// #endif
				this.$store.commit('general/SET_TOPNAV', statusBar) //导航栏高度
			},
		},
	}
</script>

<style lang="scss">
	@import './styles/ui.css';
	/* #ifndef APP-PLUS-NVUE */
	/*每个页面公共css */
	@import './styles/icon/iconfont.css';

	@import './styles/common.css';
	@import './styles/thenme.css';
	@import './styles/animation/animation.css';
	@import './styles/font/font.css';

	page {
		background: var(--bg);
		height: 100%;
	}

	uni-toast .uni-toast__content {
		padding: 0 10rpx;
		font-size: 24rpx;
	}

	/* #endif */
</style>